package com.slz3.business.module.goodsManagement.gooAttribute.steward;

import com.slz3.business.module.goodsManagement.gooAttribute.domain.GooAttribute;
import com.slz3.business.module.goodsManagement.gooAttribute.domain.GooAttributeCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

@Component
public class GooAttributeResponse {

    @Autowired
    private GooAttributeResController gooAttributeResController;

    public Mono<ServerResponse> add(ServerRequest req) {
        return req.bodyToMono(GooAttribute.class).flatMap(gooAttribute ->
                gooAttributeResController.add(req, gooAttribute)
        );
    }

    public Mono<ServerResponse> delete(ServerRequest req) {
        return req.bodyToMono(GooAttributeCondition.class).flatMap(gooAttributeCondition ->
                gooAttributeResController.delete(req, gooAttributeCondition)
        );
    }

    public Mono<ServerResponse> modify(ServerRequest req) {
        return req.bodyToMono(GooAttribute.class).flatMap(gooAttribute ->
                gooAttributeResController.modify(req, gooAttribute)
        );
    }


    public Mono<ServerResponse> list(ServerRequest req) {
        return gooAttributeResController.list(req);
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        return gooAttributeResController.info(req);
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        return gooAttributeResController.choice(req);
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req) {
        return req.bodyToMono(GooAttributeCondition.class).flatMap(gooAttributeCondition ->
                gooAttributeResController.auditSubmit(req, gooAttributeCondition)
        );
    }

    public Mono<ServerResponse> audit(ServerRequest req) {
        return req.bodyToMono(GooAttributeCondition.class).flatMap(gooAttributeCondition ->
                gooAttributeResController.audit(req, gooAttributeCondition)
        );
    }

    public Mono<ServerResponse> auditReject(ServerRequest req) {
        return req.bodyToMono(GooAttributeCondition.class).flatMap(gooAttributeCondition ->
                gooAttributeResController.auditReject(req, gooAttributeCondition)
        );
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req) {
        return req.bodyToMono(GooAttributeCondition.class).flatMap(gooAttributeCondition ->
                gooAttributeResController.usingEnable(req, gooAttributeCondition)
        );
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req) {
        return req.bodyToMono(GooAttributeCondition.class).flatMap(gooAttributeCondition ->
                gooAttributeResController.usingDisable(req, gooAttributeCondition)
        );
    }

}
